<template>
    <div>
        <!-- <input type="text"> -->
        <input type="text" @keyup.enter="add" v-model="msg">
    </div>
</template>

<script>
export default {
    props: {
        xxx: {
            String
        }
    },
    components: {

    },
    data() {
        return {
            msg: ''
        }
    },
    methods: {
        add() {
            if (!this.msg) {
                alert('内容不能为空')
            } else {
                let obj = {
                    id: this.xxx.length + 1,
                    name: this.msg,
                    isdone: false
                }
                this.xxx.unshift(obj)
                this.msg=''
            }

        }
    }
}
</script>

<style>

</style>